// license-header java merge-point
/**
 * This is only generated once! It will never be overwritten.
 * You can (and have to!) safely modify it by hand.
 */
package edu.uwlax.cs.oayonlinestore.entities;

import java.util.Date;

import edu.uwlax.cs.oayonlinestore.vo.ProductPriceVO;

/**
 * @see edu.uwlax.cs.oayonlinestore.entities.Product
 */
public class ProductDaoImpl
    extends edu.uwlax.cs.oayonlinestore.entities.ProductDaoBase
{
    /**
     * @see edu.uwlax.cs.oayonlinestore.entities.ProductDao#toProductDetailsVO(edu.uwlax.cs.oayonlinestore.entities.Product, edu.uwlax.cs.oayonlinestore.vo.ProductDetailsVO)
     */
    public void toProductDetailsVO(
        edu.uwlax.cs.oayonlinestore.entities.Product source,
        edu.uwlax.cs.oayonlinestore.vo.ProductDetailsVO target)
    {
        super.toProductDetailsVO(source, target);
        target.setExpBackInStock(new Date(source.getExpBackInStock().getTime()));
    }


    /**
     * Retrieves the entity object that is associated with the specified value object
     * from the object store. If no such entity object exists in the object store,
     * a new, blank entity is created
     */
    private edu.uwlax.cs.oayonlinestore.entities.Product loadProductFromProductDetailsVO(edu.uwlax.cs.oayonlinestore.vo.ProductDetailsVO productDetailsVO)
    {
        // @todo implement loadProductFromProductDetailsVO
        throw new java.lang.UnsupportedOperationException("edu.uwlax.cs.oayonlinestore.entities.loadProductFromProductDetailsVO(edu.uwlax.cs.oayonlinestore.vo.ProductDetailsVO) not yet implemented.");

        /* A typical implementation looks like this:
        edu.uwlax.cs.oayonlinestore.entities.Product product = this.load(productDetailsVO.getId());
        if (product == null)
        {
            product = edu.uwlax.cs.oayonlinestore.entities.Product.Factory.newInstance();
        }
        return product;
        */
    }

    
    /**
     * @see edu.uwlax.cs.oayonlinestore.entities.ProductDao#productDetailsVOToEntity(edu.uwlax.cs.oayonlinestore.vo.ProductDetailsVO)
     */
    public edu.uwlax.cs.oayonlinestore.entities.Product productDetailsVOToEntity(edu.uwlax.cs.oayonlinestore.vo.ProductDetailsVO productDetailsVO)
    {
        // @todo verify behavior of productDetailsVOToEntity
        edu.uwlax.cs.oayonlinestore.entities.Product entity = this.loadProductFromProductDetailsVO(productDetailsVO);
        this.productDetailsVOToEntity(productDetailsVO, entity, true);
        return entity;
    }


    /**
     * @see edu.uwlax.cs.oayonlinestore.entities.ProductDao#productDetailsVOToEntity(edu.uwlax.cs.oayonlinestore.vo.ProductDetailsVO, edu.uwlax.cs.oayonlinestore.entities.Product)
     */
    public void productDetailsVOToEntity(
        edu.uwlax.cs.oayonlinestore.vo.ProductDetailsVO source,
        edu.uwlax.cs.oayonlinestore.entities.Product target,
        boolean copyIfNull)
    {
        // @todo verify behavior of productDetailsVOToEntity
        super.productDetailsVOToEntity(source, target, copyIfNull);
    }

    /**
     * @see edu.uwlax.cs.oayonlinestore.entities.ProductDao#toProductVO(edu.uwlax.cs.oayonlinestore.entities.Product, edu.uwlax.cs.oayonlinestore.vo.ProductVO)
     */
    public void toProductVO(
        edu.uwlax.cs.oayonlinestore.entities.Product source,
        edu.uwlax.cs.oayonlinestore.vo.ProductVO target)
    {
        // @todo verify behavior of toProductVO
        super.toProductVO(source, target);
    }


    /**
     * Retrieves the entity object that is associated with the specified value object
     * from the object store. If no such entity object exists in the object store,
     * a new, blank entity is created
     */
    private edu.uwlax.cs.oayonlinestore.entities.Product loadProductFromProductVO(edu.uwlax.cs.oayonlinestore.vo.ProductVO productVO)
    {
        // @todo implement loadProductFromProductVO
        throw new java.lang.UnsupportedOperationException("edu.uwlax.cs.oayonlinestore.entities.loadProductFromProductVO(edu.uwlax.cs.oayonlinestore.vo.ProductVO) not yet implemented.");

        /* A typical implementation looks like this:
        edu.uwlax.cs.oayonlinestore.entities.Product product = this.load(productVO.getId());
        if (product == null)
        {
            product = edu.uwlax.cs.oayonlinestore.entities.Product.Factory.newInstance();
        }
        return product;
        */
    }

    
    /**
     * @see edu.uwlax.cs.oayonlinestore.entities.ProductDao#productVOToEntity(edu.uwlax.cs.oayonlinestore.vo.ProductVO)
     */
    public edu.uwlax.cs.oayonlinestore.entities.Product productVOToEntity(edu.uwlax.cs.oayonlinestore.vo.ProductVO productVO)
    {
        // @todo verify behavior of productVOToEntity
        edu.uwlax.cs.oayonlinestore.entities.Product entity = this.loadProductFromProductVO(productVO);
        this.productVOToEntity(productVO, entity, true);
        return entity;
    }


    /**
     * @see edu.uwlax.cs.oayonlinestore.entities.ProductDao#productVOToEntity(edu.uwlax.cs.oayonlinestore.vo.ProductVO, edu.uwlax.cs.oayonlinestore.entities.Product)
     */
    public void productVOToEntity(
        edu.uwlax.cs.oayonlinestore.vo.ProductVO source,
        edu.uwlax.cs.oayonlinestore.entities.Product target,
        boolean copyIfNull)
    {
        // @todo verify behavior of productVOToEntity
        super.productVOToEntity(source, target, copyIfNull);
    }


	public Product productPriceVOToEntity(ProductPriceVO productPriceVO) {
		edu.uwlax.cs.oayonlinestore.entities.Product product = this.load(productPriceVO.getId());
        if (product == null)
        {
            product = edu.uwlax.cs.oayonlinestore.entities.Product.Factory.newInstance();
        }
        productPriceVOToEntity(productPriceVO, product, true);
        return product;
	}

}